/** @file grid.h 
 ** @brief The multiblock grid data-structure
**/
#ifndef _GRID_H_

#define _GRID_H_

#include "block.h"
#include "refCount.h"

namespace pavan{

template < class itype , class dtype , int dim > 
  class grid : public refCount {

  public:

    /// Public set functions
    void setNumBlocks( itype nb ) {
      _nblocks = nb;
      _blocks.resize( nb );
    }

    void setBlockExtent( itype i , DECL_VEC( itype , dim ) &range ){
      if( i < _blocks.size() && i >= 0 ){
        _blocks[i].setExtent( range );
      }
    }

    /// Public get functions
    const DECL_BZ_VEC( dtype , dim ) &getBlockCoords( itype i ) {
      if( i < _blocks.size() && i >=0 )
        return _blocks[i].getCoords();
    }
 
    const DECL_BLOCK_VEC( itype , dtype , dim ) &getAllBlocks(){
      return _blocks;
    }
 
  private:
    itype _nblocks;
    DECL_BLOCK_VEC( itype , dtype , dim ) _blocks;
    Time _time;    
};

}

#endif
